package library.commands;

import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import library.domain.Book;
import library.server.Config;
import library.service.BookService;

public class DownloadCommand extends Command {

    public DownloadCommand(ObjectInputStream input, ObjectOutputStream output, Socket socket) {
        super(input, output, socket);
    }

    @Override
    public void execute() throws Exception {
        Integer id = (Integer) input.readObject();

        BookService bookService =  serviceLocator.getService(BookService.class);
        Book b = bookService.getBook(id, true);
        
        output.writeObject(b);
    }
}
